import { 
    FOLLOWINGS_DATA, 
    FOLLOWERS_DATA, 
    FOLLOW_UPDATED,
    TOPIC_FOLLOWINGS_DATA,
    TOPIC_FOLLOW_UPDATED,
} from '../actions/FollowActions';

const initialState = {
    error: null,
    followingsData: [],
    followersData: [],
    updatedFollow: {},
    topicFollowingsData: [],
    updatedTopicFollow: {}
}

const FollowReducer = (state = initialState, action) => {
    switch (action.type) {
        case FOLLOWINGS_DATA:
            return {
                ...state,
                followingsData: action.data,
            }
        case FOLLOWERS_DATA:
            return {
                ...state,
                followersData: action.data,
            }
        case FOLLOW_UPDATED:
            return {
                ...state,
                updatedFollow: action.data,
            }
        case TOPIC_FOLLOWINGS_DATA:
            return {
                ...state,
                topicFollowingsData: action.data,
            }
        case TOPIC_FOLLOW_UPDATED:
            return {
                ...state,
                updatedTopicFollow: action.data,
            }
        default:
            return {...state};
    }
};

export default FollowReducer;